package com.project.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.bean.EmployeeBean;
import com.project.bean.ProjectBean;
import com.project.mapper.IProjectMapper;
import com.project.service.IProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 项目接口实现类
 */
@Service
@Transactional
public class ProjectServiceImpl implements IProjectService {
    @Autowired
    private IProjectMapper mapper;

    @Override
    public PageInfo<ProjectBean> findByItem(int pageNum, String name, String state, String ruler) {
        PageHelper.startPage(pageNum,PAGESIZE);
        PageInfo<ProjectBean> info = PageInfo.of(mapper.findByItem(pageNum, name, state, ruler));
        return info;
    }

    @Override
    public void add(ProjectBean projectBean) {
        mapper.add(projectBean);
    }

    @Override
    public List<ProjectBean> findById(int id) {
        return mapper.findById(id);
    }

    @Override
    public List<ProjectBean> findNoFinish() {
        return mapper.findNoFinish();
    }

    @Override
    public void finishProject(int projectId) {
        mapper.finishProject(projectId);
    }
}
